<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@taglib uri="/struts-tags" prefix="s"%>

<html>

<s:include value="header.jsp" />

<body>
	<div id="container">
		<div id="header">
			<a href="http://opencities.upf.edu"><img src="images/logo.png"></a>
			<s:if test="#request.editService == 'yes'">
				<h1>Edit Service</h1>
			</s:if>
			<s:else>
				<h1>Register a New Data Set</h1>
			</s:else>

		</div>

		<!-- Menu -->
		<s:include value="menu.jsp" />

		<!-- Content -->
		<div id="content" align="center">

			<div id="asideleft">

				<h2>Help</h2>

				For further information remember to visit the <a
					href="https://wikis.dtic.upf.edu/wikis/opencitie">wiki</a>. <br>
				<p>
					<b>Service Name:</b> describe in a high level what the service is
					about. Avoid using technical names.
				</p>
				<p>
					<b>Description:</b> describe the service and add any information
					you consider interesting for the data consumer
				</p>
				<p>
					<b>Update Period:</b> write the data time interval. You must
					include the time units.
				</p>
				<p>
					<b>URL:</b> If any, address of the data sets web
				</p>
				
							<p>
				<b>Tags:</b> write the tags that describe your service. You must add a comma between each tag. Eg: temperature, barcelona, weather, Barcelong city council</b> 
				</p>
				<p>
					<b>Geo-localization:</b> You can specify the latitude and the longitude of the sensor.<br> Eg: Latitude: 41.03254, Longitude: 2.01697.
				If stead of a point you want to specify a line, add a comma between the start point and the end point. <br>Eg: Latitude: 41.03254, 42.0124, Longitude: 2.01697,3.0125.
				</p>
				<br>
				
			</div>


			<div id="asideright">
				<s:if test="#session.edit == 'false'">
					<h2>New Data Set </h2>
					<div id="stylized">
						<s:form id="form" action="registerNewService" method="post">
							<s:hidden name="isValidable" value="true" />
							<s:textfield name="newService.name" label="Name*" value="" />
							<s:password name="newService.password" label="Password*" value="" />
							<s:password name="confirmServicePassword" label="Confirm password*" value="" />
							<s:textfield name="newService.author" label="Author" readonly="false" />
							<s:select name="selectGroup" label="Select by" list="rawGroupList" style="width:360px"/>
							<s:textarea name="newService.description" label="Description" rows="7"/>
							<s:textfield name="tempTagList" label="Tags*" value="%{tempTagList}" readonly="false" />
							<s:textfield name="newService.latitude" label="Latitude" value="%{newService.latitude}" readonly="false" />
							<s:textfield name="newService.longitude" label="Longitude" value="%{newService.longitude}" readonly="false" />
							<s:textfield name="newService.updatePeriod" label="Update Period" />
							<s:select name="selectLicense" label="Select by"list="licenseList" value="4" style="width:360px" />
							<s:textfield name="newService.url" label="URL" />
							<s:if test="#session.edit == 'false'">
							<s:submit type="button" value="Create!" />
							</s:if>
							<s:else>
							<s:submit type="button" value="Update!" />
						</s:else>					
						</s:form>
					</div>
					<p>Fields with * are mandatory</p>
				</s:if>
				<s:else>
					<h2>Update Registration Form </h2>
					<div id="stylized">
					<s:form id="form" action="updateService" method="post">
							<s:hidden name="isValidable" value="true" />
							<s:hidden name="isUpdate" value="true" />
							<s:hidden name="newService.id"/>
							<s:textfield name="newService.name" label="Name*" readonly="true" />
							<s:password name="newService.password" label="Password*" value="" />
							<s:textfield name="newService.author" label="Author"
								readonly="false" />
							<s:textarea name="newService.description" label="Description" />
							<s:textfield name="tempTagList" label="Tags*" value="%{tempTagList}" readonly="false" />
							<s:textfield name="newService.latitude" label="Latitude" value="%{newService.latitude}" readonly="false" />
							<s:textfield name="newService.longitude" label="Longitude" value="%{newService.longitude}" readonly="false" />
							<s:textfield name="newService.updatePeriod" label="Update Period" />
							<s:select name="selectGroup" label="Select by" list="rawGroupList" style="width:360px"/>
							<s:textfield name="newService.url" label="URL" />
							<s:select name="selectLicense" label="Select by"list="licenseList" value="4" style="width:360px" />
							<s:submit type="button" value="Continue" />
						</s:form>
					</div>
				</s:else>
			<div id="bottom"></div>
		</div>
		<s:include value="footer.jsp" />
	</div>
</body>

</html>
